From c88087b694bff9bf1c7cb533fa675dfbf8a7c976 Mon Sep 17 00:00:00 2001 From: Kristian Rietveld Date: Fri, 27 Oct 2006 19:59:16 +0000 Subject: [PATCH] rework the area_above == 0 case to not overwrite the variables in the 2006-10-27 Kristian Rietveld * gtk/gtktreeview.c (validate_visible_area): rework the area_above == 0 case to not overwrite the variables in the lower scope (which are used later on ...), get the path correctly and bail out when there isn't a node above us. (#359231). --- ChangeLog | 7 +++++++ gtk/gtktreeview.c | 40 +++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 913f542ed6..ab4ef4e1dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-10-27 Kristian Rietveld + + * gtk/gtktreeview.c (validate_visible_area): rework the area_above == 0 + case to not overwrite the variables in the lower scope (which are + used later on ...), get the path correctly and bail out when there + isn't a node above us. (#359231). + 2006-10-26 Christian Persch * gtk/gtkaboutdialog.c: Put initial focus on Close button (#337261). diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index e36942022f..ba64daa0db 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -5742,32 +5742,30 @@ validate_visible_area (GtkTreeView *tree_view) */ if (area_above == 0) { - GtkRBTree *tree; - GtkRBNode *node; - GtkTreePath *tmppath; - GtkTreeIter iter; - - _gtk_tree_view_find_node (tree_view, above_path, &tree, &node); + GtkRBTree *tmptree; + GtkRBNode *tmpnode; - tmppath = gtk_tree_path_copy (above_path); + _gtk_tree_view_find_node (tree_view, above_path, &tmptree, &tmpnode); + _gtk_rbtree_prev_full (tmptree, tmpnode, &tmptree, &tmpnode); - _gtk_rbtree_prev_full (tree, node, &tree, &node); - if (! gtk_tree_path_prev (tmppath) && node != NULL) + if (tmpnode) { - gtk_tree_path_free (tmppath); - tmppath = _gtk_tree_view_find_path (tree_view, tree, node); - } - gtk_tree_model_get_iter (tree_view->priv->model, &iter, tmppath); + GtkTreePath *tmppath; + GtkTreeIter tmpiter; - if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_INVALID) || - GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_COLUMN_INVALID)) - { - _gtk_tree_view_queue_draw_node (tree_view, tree, node, NULL); - if (validate_row (tree_view, tree, node, &iter, path)) - size_changed = TRUE; - } + tmppath = _gtk_tree_view_find_path (tree_view, tmptree, tmpnode); + gtk_tree_model_get_iter (tree_view->priv->model, &tmpiter, tmppath); + + if (GTK_RBNODE_FLAG_SET (tmpnode, GTK_RBNODE_INVALID) || + GTK_RBNODE_FLAG_SET (tmpnode, GTK_RBNODE_COLUMN_INVALID)) + { + _gtk_tree_view_queue_draw_node (tree_view, tmptree, tmpnode, NULL); + if (validate_row (tree_view, tmptree, tmpnode, &tmpiter, tmppath)) + size_changed = TRUE; + } - gtk_tree_path_free (tmppath); + gtk_tree_path_free (tmppath); + } } /* Now, we walk forwards and backwards, measuring rows. Unfortunately, -- 2.30.2